import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  { path: '/', redirect: '/home' },
  {
    path: '/home',
    component: () => import('../views/Home.vue'),
    redirect: '/home/discover',
    children: [
      {
        path: 'discover',
        component: () => import('../views/Discover/Discover.vue'),
        redirect: '/home/discover/recommend',
        children: [
          {
            path: 'recommend',
            component: () => import('../views/Discover/Recommend.vue'),
          },
          {
            path: 'songlist',
            component: () => import('../views/Discover/SongList.vue'),
          },
          {
            path: 'ranking',
            component: () => import('../views/Discover/Ranking.vue'),
          },
          {
            path: 'singer',
            component: () => import('../views/Discover/Singer.vue'),
          },
        ],
      },
      {
        path: 'musiclistdetail/:id',
        name: 'musicListDetail',
        component: () => import('../views/MusicListDetail/MusicListDetail.vue'),
      },
    ],
  },
]

const router = createRouter({
  history: createWebHistory(),
  routes,
})

export default router
